//引包
document.write("<script type='text/javascript' src='js/createObject.js'></script>");
document.write("<script type='text/javascript' src='js/varfiyInfor.js'></script>");
var a,b,c,d,e;

window.onload=function(){
	
	document.getElementById("form-phone").onblur=function(){

    	var phone = document.getElementById('form-phone').value;

		a=varify(phone);
		
		if(a){
			varifyLogin(phone);
		}

	}
	
	document.getElementById("form-user").onblur=function(){

    	var userID = document.getElementById('form-user').value;
		
		b=varfiyUser(userID);
		
		if(b){
			
			userLogin(userID);
			
		}

	}
	
	
	
	document.getElementById("form-pas").onkeyup=function(){

    	var password = document.getElementById('form-pas').value;

		c=varfiyPas(password);

	}
	
	document.getElementById("form-pas").onblur=function(){

    	if(c){
    		document.getElementById("form-t3").innerHTML="";
    	}

	}
	
	document.getElementById("form-pas1").onkeyup=function(){

    	var password = document.getElementById('form-pas').value;

		var pas1 = document.getElementById('form-pas1').value;
		
		d=fitPas(password,pas1);

	}
	
	document.getElementById("form-pas1").onblur=function(){

    	if(d){
    		document.getElementById("form-t4").innerHTML="";
    	}

	}
	
	document.getElementById("zhifu-pas").onkeyup=function(){
		
		var zhifuPas = document.getElementById("zhifu-pas").value;
		
		e=varfiyZhifuP(zhifuPas);
		
	}
	
	
	document.getElementById("zc-ok").onclick=function(){
		
		if(a&&b&&c&&d&&e){

			var xmlRequest = createXHQ();
			
			xmlRequest.open("POST","url");
			
			xmlRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");

			var parameter = "phone=" + document.getElementById("form-phone").value +"&username=" + document.getElementById("form-user").value
							+"&pas="+ document.getElementById("form-pas").value ;
			
			xmlRequest.send(parameter);

			xmlRequest.onreadystatechange = function(){
				if(xmlRequest.readyState===4){
					if(xmlRequest.status===200){
						var ret = xmlRequest.responseText;
						var resultJ = JSON.parse(ret);
						
						alert(resultJ);
					}else{
						document.getElementById("form-pas").value="";
						document.getElementById("form-pas1").value="";
						alert("错误代码："+xmlRequest.status);
					}
				}
			}
		
		}else{
			alert("请检查数据的正确性：");
			window.location.reload();
		}

	}

}
		
